﻿#region Includes

using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Threading;
using System.Web.Services;
using System.Web.Services.Description;
using System.Web.Services.Protocols;
using System.Xml.Serialization;
using WaveTech.GShield.Engine.Properties;

#endregion

#pragma warning disable 1591

namespace WaveTech.GShield.Engine.GShieldAdvisorService
{
	/// <remarks/>
	[GeneratedCode("System.Web.Services", "2.0.50727.1378")]
	[DebuggerStepThrough]
	[DesignerCategory("code")]
	[WebServiceBinding(Name = "GShieldAdvisorServiceSoap", Namespace = "http://www.wtdt.com/gshieldadvisor/")]
	public class GShieldAdvisorService : SoapHttpClientProtocol
	{
		private SendOrPostCallback GetESRBGameDetailExOperationCompleted;
		private SendOrPostCallback GetESRBGameDetailOperationCompleted;
		private SendOrPostCallback GetESRBRatingExOperationCompleted;
		private SendOrPostCallback GetESRBRatingOperationCompleted;

		private bool useDefaultCredentialsSetExplicitly;

		/// <remarks/>
		public GShieldAdvisorService()
		{
			Url = Settings.Default.Engine_GShieldAdvisorService_GShieldAdvisorService;
			if (IsLocalFileSystemWebService(Url))
			{
				UseDefaultCredentials = true;
				useDefaultCredentialsSetExplicitly = false;
			}
			else
			{
				useDefaultCredentialsSetExplicitly = true;
			}
		}

		public new string Url
		{
			get { return base.Url; }
			set
			{
				if (((IsLocalFileSystemWebService(base.Url)
				      && (useDefaultCredentialsSetExplicitly == false))
				     && (IsLocalFileSystemWebService(value) == false)))
				{
					base.UseDefaultCredentials = false;
				}
				base.Url = value;
			}
		}

		public new bool UseDefaultCredentials
		{
			get { return base.UseDefaultCredentials; }
			set
			{
				base.UseDefaultCredentials = value;
				useDefaultCredentialsSetExplicitly = true;
			}
		}

		/// <remarks/>
		public event GetESRBRatingCompletedEventHandler GetESRBRatingCompleted;

		/// <remarks/>
		public event GetESRBRatingExCompletedEventHandler GetESRBRatingExCompleted;

		/// <remarks/>
		public event GetESRBGameDetailCompletedEventHandler GetESRBGameDetailCompleted;

		/// <remarks/>
		public event GetESRBGameDetailExCompletedEventHandler GetESRBGameDetailExCompleted;

		/// <remarks/>
		[SoapDocumentMethod("http://www.wtdt.com/gshieldadvisor/GetESRBRating",
			RequestNamespace = "http://www.wtdt.com/gshieldadvisor/", ResponseNamespace = "http://www.wtdt.com/gshieldadvisor/",
			Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
		[return: XmlElement(IsNullable = true)]
		public int? GetESRBRating(string title, string publisher, string fileName, string directoryName, string productName)
		{
			object[] results = Invoke("GetESRBRating", new object[]
			                                           	{
			                                           		title,
			                                           		publisher,
			                                           		fileName,
			                                           		directoryName,
			                                           		productName
			                                           	});
			return ((int?) (results[0]));
		}

		/// <remarks/>
		public void GetESRBRatingAsync(string title, string publisher, string fileName, string directoryName,
		                               string productName)
		{
			GetESRBRatingAsync(title, publisher, fileName, directoryName, productName, null);
		}

		/// <remarks/>
		public void GetESRBRatingAsync(string title, string publisher, string fileName, string directoryName,
		                               string productName, object userState)
		{
			if ((GetESRBRatingOperationCompleted == null))
			{
				GetESRBRatingOperationCompleted = OnGetESRBRatingOperationCompleted;
			}
			InvokeAsync("GetESRBRating", new object[]
			                             	{
			                             		title,
			                             		publisher,
			                             		fileName,
			                             		directoryName,
			                             		productName
			                             	}, GetESRBRatingOperationCompleted, userState);
		}

		private void OnGetESRBRatingOperationCompleted(object arg)
		{
			if ((GetESRBRatingCompleted != null))
			{
				InvokeCompletedEventArgs invokeArgs = ((InvokeCompletedEventArgs) (arg));
				GetESRBRatingCompleted(this,
				                       new GetESRBRatingCompletedEventArgs(invokeArgs.Results, invokeArgs.Error,
				                                                           invokeArgs.Cancelled, invokeArgs.UserState));
			}
		}

		/// <remarks/>
		[SoapDocumentMethod("http://www.wtdt.com/gshieldadvisor/GetESRBRatingEx",
			RequestNamespace = "http://www.wtdt.com/gshieldadvisor/", ResponseNamespace = "http://www.wtdt.com/gshieldadvisor/",
			Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
		[return: XmlElement(IsNullable = true)]
		public int? GetESRBRatingEx(string title, string publisher, string fileName, string directoryName, string productName,
		                            bool trimResults)
		{
			object[] results = Invoke("GetESRBRatingEx", new object[]
			                                             	{
			                                             		title,
			                                             		publisher,
			                                             		fileName,
			                                             		directoryName,
			                                             		productName,
			                                             		trimResults
			                                             	});
			return ((int?) (results[0]));
		}

		/// <remarks/>
		public void GetESRBRatingExAsync(string title, string publisher, string fileName, string directoryName,
		                                 string productName, bool trimResults)
		{
			GetESRBRatingExAsync(title, publisher, fileName, directoryName, productName, trimResults, null);
		}

		/// <remarks/>
		public void GetESRBRatingExAsync(string title, string publisher, string fileName, string directoryName,
		                                 string productName, bool trimResults, object userState)
		{
			if ((GetESRBRatingExOperationCompleted == null))
			{
				GetESRBRatingExOperationCompleted = OnGetESRBRatingExOperationCompleted;
			}
			InvokeAsync("GetESRBRatingEx", new object[]
			                               	{
			                               		title,
			                               		publisher,
			                               		fileName,
			                               		directoryName,
			                               		productName,
			                               		trimResults
			                               	}, GetESRBRatingExOperationCompleted, userState);
		}

		private void OnGetESRBRatingExOperationCompleted(object arg)
		{
			if ((GetESRBRatingExCompleted != null))
			{
				InvokeCompletedEventArgs invokeArgs = ((InvokeCompletedEventArgs) (arg));
				GetESRBRatingExCompleted(this,
				                         new GetESRBRatingExCompletedEventArgs(invokeArgs.Results, invokeArgs.Error,
				                                                               invokeArgs.Cancelled, invokeArgs.UserState));
			}
		}

		/// <remarks/>
		[SoapDocumentMethod("http://www.wtdt.com/gshieldadvisor/GetESRBGameDetail",
			RequestNamespace = "http://www.wtdt.com/gshieldadvisor/", ResponseNamespace = "http://www.wtdt.com/gshieldadvisor/",
			Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
		public GameRatingDetail GetESRBGameDetail(string title, string publisher, string fileName, string directoryName,
		                                          string productName)
		{
			object[] results = Invoke("GetESRBGameDetail", new object[]
			                                               	{
			                                               		title,
			                                               		publisher,
			                                               		fileName,
			                                               		directoryName,
			                                               		productName
			                                               	});
			return ((GameRatingDetail) (results[0]));
		}

		/// <remarks/>
		public void GetESRBGameDetailAsync(string title, string publisher, string fileName, string directoryName,
		                                   string productName)
		{
			GetESRBGameDetailAsync(title, publisher, fileName, directoryName, productName, null);
		}

		/// <remarks/>
		public void GetESRBGameDetailAsync(string title, string publisher, string fileName, string directoryName,
		                                   string productName, object userState)
		{
			if ((GetESRBGameDetailOperationCompleted == null))
			{
				GetESRBGameDetailOperationCompleted = OnGetESRBGameDetailOperationCompleted;
			}
			InvokeAsync("GetESRBGameDetail", new object[]
			                                 	{
			                                 		title,
			                                 		publisher,
			                                 		fileName,
			                                 		directoryName,
			                                 		productName
			                                 	}, GetESRBGameDetailOperationCompleted, userState);
		}

		private void OnGetESRBGameDetailOperationCompleted(object arg)
		{
			if ((GetESRBGameDetailCompleted != null))
			{
				InvokeCompletedEventArgs invokeArgs = ((InvokeCompletedEventArgs) (arg));
				GetESRBGameDetailCompleted(this,
				                           new GetESRBGameDetailCompletedEventArgs(invokeArgs.Results, invokeArgs.Error,
				                                                                   invokeArgs.Cancelled, invokeArgs.UserState));
			}
		}

		/// <remarks/>
		[SoapDocumentMethod("http://www.wtdt.com/gshieldadvisor/GetESRBGameDetailEx",
			RequestNamespace = "http://www.wtdt.com/gshieldadvisor/", ResponseNamespace = "http://www.wtdt.com/gshieldadvisor/",
			Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
		public GameRatingDetail GetESRBGameDetailEx(string title, string publisher, string fileName, string directoryName,
		                                            string productName, bool trimResults)
		{
			object[] results = Invoke("GetESRBGameDetailEx", new object[]
			                                                 	{
			                                                 		title,
			                                                 		publisher,
			                                                 		fileName,
			                                                 		directoryName,
			                                                 		productName,
			                                                 		trimResults
			                                                 	});
			return ((GameRatingDetail) (results[0]));
		}

		/// <remarks/>
		public void GetESRBGameDetailExAsync(string title, string publisher, string fileName, string directoryName,
		                                     string productName, bool trimResults)
		{
			GetESRBGameDetailExAsync(title, publisher, fileName, directoryName, productName, trimResults, null);
		}

		/// <remarks/>
		public void GetESRBGameDetailExAsync(string title, string publisher, string fileName, string directoryName,
		                                     string productName, bool trimResults, object userState)
		{
			if ((GetESRBGameDetailExOperationCompleted == null))
			{
				GetESRBGameDetailExOperationCompleted = OnGetESRBGameDetailExOperationCompleted;
			}
			InvokeAsync("GetESRBGameDetailEx", new object[]
			                                   	{
			                                   		title,
			                                   		publisher,
			                                   		fileName,
			                                   		directoryName,
			                                   		productName,
			                                   		trimResults
			                                   	}, GetESRBGameDetailExOperationCompleted, userState);
		}

		private void OnGetESRBGameDetailExOperationCompleted(object arg)
		{
			if ((GetESRBGameDetailExCompleted != null))
			{
				InvokeCompletedEventArgs invokeArgs = ((InvokeCompletedEventArgs) (arg));
				GetESRBGameDetailExCompleted(this,
				                             new GetESRBGameDetailExCompletedEventArgs(invokeArgs.Results, invokeArgs.Error,
				                                                                       invokeArgs.Cancelled, invokeArgs.UserState));
			}
		}

		/// <remarks/>
		public new void CancelAsync(object userState)
		{
			base.CancelAsync(userState);
		}

		private bool IsLocalFileSystemWebService(string url)
		{
			if (((url == null)
			     || (url == string.Empty)))
			{
				return false;
			}
			Uri wsUri = new Uri(url);
			if (((wsUri.Port >= 1024)
			     && (string.Compare(wsUri.Host, "localHost", StringComparison.OrdinalIgnoreCase) == 0)))
			{
				return true;
			}
			return false;
		}
	}

	/// <remarks/>
	[GeneratedCode("System.Xml", "2.0.50727.1378")]
	[Serializable]
	[DebuggerStepThrough]
	[DesignerCategory("code")]
	[XmlType(Namespace = "http://www.wtdt.com/gshieldadvisor/")]
	public class GameRatingDetail
	{
		/// <remarks/>
		public string Name { get; set; }

		/// <remarks/>
		public string Publisher { get; set; }

		/// <remarks/>
		public string Rating { get; set; }

		/// <remarks/>
		public string Content { get; set; }

		/// <remarks/>
		public string Platforms { get; set; }

		/// <remarks/>
		[XmlElement(IsNullable = true)]
		public bool? Exact { get; set; }
	}

	/// <remarks/>
	[GeneratedCode("System.Web.Services", "2.0.50727.1378")]
	public delegate void GetESRBRatingCompletedEventHandler(object sender, GetESRBRatingCompletedEventArgs e);

	/// <remarks/>
	[GeneratedCode("System.Web.Services", "2.0.50727.1378")]
	[DebuggerStepThrough]
	[DesignerCategory("code")]
	public class GetESRBRatingCompletedEventArgs : AsyncCompletedEventArgs
	{
		private readonly object[] results;

		internal GetESRBRatingCompletedEventArgs(object[] results, Exception exception, bool cancelled, object userState) :
			base(exception, cancelled, userState)
		{
			this.results = results;
		}

		/// <remarks/>
		public int? Result
		{
			get
			{
				RaiseExceptionIfNecessary();
				return ((int?) (results[0]));
			}
		}
	}

	/// <remarks/>
	[GeneratedCode("System.Web.Services", "2.0.50727.1378")]
	public delegate void GetESRBRatingExCompletedEventHandler(object sender, GetESRBRatingExCompletedEventArgs e);

	/// <remarks/>
	[GeneratedCode("System.Web.Services", "2.0.50727.1378")]
	[DebuggerStepThrough]
	[DesignerCategory("code")]
	public class GetESRBRatingExCompletedEventArgs : AsyncCompletedEventArgs
	{
		private readonly object[] results;

		internal GetESRBRatingExCompletedEventArgs(object[] results, Exception exception, bool cancelled, object userState) :
			base(exception, cancelled, userState)
		{
			this.results = results;
		}

		/// <remarks/>
		public int? Result
		{
			get
			{
				RaiseExceptionIfNecessary();
				return ((int?) (results[0]));
			}
		}
	}

	/// <remarks/>
	[GeneratedCode("System.Web.Services", "2.0.50727.1378")]
	public delegate void GetESRBGameDetailCompletedEventHandler(object sender, GetESRBGameDetailCompletedEventArgs e);

	/// <remarks/>
	[GeneratedCode("System.Web.Services", "2.0.50727.1378")]
	[DebuggerStepThrough]
	[DesignerCategory("code")]
	public class GetESRBGameDetailCompletedEventArgs : AsyncCompletedEventArgs
	{
		private readonly object[] results;

		internal GetESRBGameDetailCompletedEventArgs(object[] results, Exception exception, bool cancelled, object userState)
			:
				base(exception, cancelled, userState)
		{
			this.results = results;
		}

		/// <remarks/>
		public GameRatingDetail Result
		{
			get
			{
				RaiseExceptionIfNecessary();
				return ((GameRatingDetail) (results[0]));
			}
		}
	}

	/// <remarks/>
	[GeneratedCode("System.Web.Services", "2.0.50727.1378")]
	public delegate void GetESRBGameDetailExCompletedEventHandler(object sender, GetESRBGameDetailExCompletedEventArgs e);

	/// <remarks/>
	[GeneratedCode("System.Web.Services", "2.0.50727.1378")]
	[DebuggerStepThrough]
	[DesignerCategory("code")]
	public class GetESRBGameDetailExCompletedEventArgs : AsyncCompletedEventArgs
	{
		private readonly object[] results;

		internal GetESRBGameDetailExCompletedEventArgs(object[] results, Exception exception, bool cancelled, object userState)
			:
				base(exception, cancelled, userState)
		{
			this.results = results;
		}

		/// <remarks/>
		public GameRatingDetail Result
		{
			get
			{
				RaiseExceptionIfNecessary();
				return ((GameRatingDetail) (results[0]));
			}
		}
	}
}

#pragma warning restore 1591